import lejos.nxt.Button;
import lejos.nxt.LCD;

public class Modes {
	public static void main(String[] args) { }
	
	private int speed = 0;							//if you can't choose a mode then something is broke and the robot should'n move
	private String mode = "";						//which move was taken
	
	public void chooseMode(){
		Button b1 = Button.LEFT;					//left Button on the Brick
		Button b2 = Button.RIGHT;					//right Button on the Brick
		boolean status = false;						//status for mode set or not set
		while(!status){								//runs as long as no mode chosen
			LCD.drawString("Choose one mode.", 0, 0);		//message for the user
			LCD.drawString("Right Button for", 0, 1);
			LCD.drawString("slow cleaning mode", 0, 2);
			LCD.drawString("Left Button for", 0, 3);
			LCD.drawString("fast cleaning mode", 0, 4);
			if(b1.isDown()) {						//left buttton is bressed
				setSpeed(300);						//speed set is 50
				status = true;						//with this the while loop will end
				mode = "fast cleaning";				//mode set
			}
			else if(b2.isDown()) {					//right button pressed
				setSpeed(150);						//speed set 20
				status = true;						//status changed
				mode = "slow cleaning";
			}				
		}
		LCD.clear();										//clear the display
		LCD.drawString("Mode set: " + toString(),0,0);		//message for the user
	}
	
	private void setSpeed(int speed) {
		this.speed = speed;
	}
	public int getSpeed() {
		return speed;
	}
	public String toString() {
		return mode;
	}


}
